package com.tender.utils;

import org.jasypt.util.text.BasicTextEncryptor;

public class EncryptorUtils {

    public static void main(String[] args) {
        // BasicTextEncryptor 的默认加密算法为： PBEWithMD5AndDES
        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        // 这个是加密的盐
        textEncryptor.setPassword("jg1HwtUwkFIN7HSV");
        String userName = textEncryptor.encrypt("YTG_IGATE");
        String passWord = textEncryptor.encrypt("YTG_IGATE");

        System.out.println("------------------ 加密操作 ------------------");
        System.out.println("userName加密后 = " + userName);
        System.out.println("passWord加密后 = " + passWord);

        System.out.println("------------------ 解密操作 ------------------");
        System.out.println("userName解密后 = " + textEncryptor.decrypt("K6C0xjEmVzKhM36sW1+BUPWVcp6yC5oE"));
        System.out.println("passWord解密后 = " + textEncryptor.decrypt("ynIyKyT+3BnfdR0SAjHilyleUugAOHoi"));
    }
}
